#include <stdio.h>
#include <stdlib.h>

struct node {
	int data;
	struct node *next;
};

void push(struct node **, int);

void main(void) {
	struct node *head = NULL;
	
	int i;

	for (i = 0; i < 10; i ++) {	
		push(&head, i);
	}

	for (i = 0; i < 10; i ++) {
		printf("%d ", head->data);
		head = head->next;
	}
	printf("\n");
}

void push(struct node **ref, int data) {
	struct node * new_node;
	new_node = malloc(sizeof(struct node));
	new_node->data = data;
	new_node->next = *ref;
	*ref = new_node;

}
